Skip to content

Conversation

@andy-stark-redis
Copy link
Contributor

@andy-stark-redis andy-stark-redis commented Apr 3, 2025

DOC-4997

This adds info about async connections and commands and also examples of using Qt and libevent in your app.

I'm wondering if it would also be a good idea to have an example of a simple RAII C++ class (connects to Redis synchronously in the constructor, disconnects in the destructor, couple of command methods, etc). I'm happy to add this if it would be useful, but it might not be a good idea if we've got plans for a proper C++ integration in the near future. Best not to confuse people :-)

@andy-stark-redis andy-stark-redis requested review from a team and uglide April 3, 2025 12:19
@andy-stark-redis andy-stark-redis self-assigned this Apr 3, 2025
Copy link
Collaborator

@dwdougherty dwdougherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question re. the copying of headers. Otherwise, language LGTM.

Build `hiredis` if you have not already done so (see
[Build and install]({{< relref "/develop/clients/hiredis#build-and-install" >}})
for more information). Copy the following files from the `hiredis` folder into
the Header files section of your Qt project:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious... wouldn't there be a standard place where these header files get installed after running make install? Seems a bit odd to be copying header files like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought that too. I assumed if you wrote #include <xxx.h> it would find the file if you had installed it but I got an error when I tried to do that (it specifically said 'try using "" includes instead of <>". I should try to investigate this further before merging.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The C standard leaves the process for finding files #include'd up to the implementation. But GCC's documentation describes it well, and I would be suprised if any compiler did it differently [1]. Basically, #include <hiredis.h> will look through the systems include directories or any directory passed through the -I argument. Using #include "hiredis.h" will do the same thing if the header cannot be found in directory containing the source file that includes it.

[1] https://gcc.gnu.org/onlinedocs/gcc-14.2.0/cpp/Search-Path.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed the header lines and the corresponding advice in the text. Thanks @dwdougherty and @collinfunk for your help with this :-)

@andy-stark-redis andy-stark-redis merged commit 5579a6a into main Apr 7, 2025
5 checks passed
@andy-stark-redis andy-stark-redis deleted the DOC-4997-hiredis-qt-example branch April 7, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants